import torch
from torchvision import datasets, models, transforms
from PIL import Image
data_transforms = transforms.Compose([
        transforms.RandomResizedCrop(224),
        transforms.RandomHorizontalFlip(),
        transforms.ToTensor(),
        transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
    ])
import torch
import torch.nn as nn
import torch.nn.functional as F





device = torch.device("cuda" if (torch.cuda.is_available()) else "cpu")
fakeFaceModel=models.vgg16().to(device)
fakeFaceModel.load_state_dict(torch.load("fakeFace.pth"))
fakeFaceModel.to('cpu')
image=data_transforms(Image.open("E:/测试人脸/1.png").convert('RGB'))
outputs=fakeFaceModel(image)
_, predicted = torch.max(outputs, 1)
print(predicted)
